home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 13 / AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso / rexx / xpk.filer < prev    next >
Text File  |  1997-06-14  |  2KB  |  112 lines

  1. /* 
  2.  
  3.    $VER: XPK.filer 2.5 (15.7.97)
  4.  
  5.    Author:
  6.     Matthias Scheler <tron@core.de>
  7.  
  8.    Function:
  9.     All selected files and directories in the active directory listview will
  10.     be packed with XPK. If a compression method is supplied it will be used.
  11.     Else a string requester will appear and ask for the method.
  12.  
  13.    History:
  14.     2.5   changed to take advantage of "GETNUMENTRIES SELECTED"
  15.     2.4   removed unnecessary ADDRESS 'FilerRexx'
  16.  
  17.    Requires:
  18.     XPK 2.x or newer
  19.     xPack 1.x or newer
  20.  
  21.    Call:
  22.     XPK [METHOD]
  23.  
  24.    Example for "Filer.RC":
  25.     BUTTON ...,...,"Pack","RX XPK"
  26.    or:
  27.     BUTTON ...,...,"Nuke'em","RX XPK NUKE"
  28.  
  29. */
  30.  
  31. PARSE ARG Compressor
  32.  
  33. OPTIONS RESULTS
  34.  
  35. LOCKFILER
  36. IF RESULT="RESULT" THEN EXIT 5
  37. Key=Result
  38.  
  39. PANEL OFF
  40.  
  41. GETSOURCEPATH
  42. IF RESULT="RESULT" THEN
  43.  DO
  44.   PANEL ON
  45.   UNLOCKFILER Key
  46.  
  47.   EXIT 5
  48.  END
  49. SourceDir=RESULT
  50.  
  51. GETNUMENTRIES SELECTED
  52. IF RESULT=0 THEN
  53.  DO
  54.   PANEL ON
  55.   UNLOCKFILER Key
  56.  
  57.   EXIT 5
  58.  END
  59.  
  60. 'STATUS XPK compression'
  61.  
  62. IF Compressor="" THEN
  63.  DO
  64.   'SETSTRING NUKE'
  65.   'GETSTRING Enter XPK compression method:'
  66.  
  67.   IF RESULT="RESULT" THEN
  68.    DO
  69.     PANEL ON
  70.     UNLOCKFILER Key
  71.  
  72.     'STATUS XPK compression aborted'
  73.     EXIT 5
  74.    END
  75.  
  76.   Compressor=RESULT
  77.  END
  78.  
  79. GETNUMENTRIES
  80. Num=RESULT
  81. DO Index=1 TO Num
  82.  GETNAME Index
  83.  Data=RESULT
  84.  Name=SUBSTR(Data,2)
  85.  
  86.  IF RIGHT(SourceDir,1)=":" THEN SourceName=SourceDir||Name
  87.  ELSE SourceName=SourceDir||"/"||Name
  88.  
  89.  IF LEFT(Data,1)="f" THEN
  90.   DO
  91.    'EXEC xPack "'||SourceName||'" METHOD' Compressor 'ALL'
  92.    TOGGLEENTRY Index
  93.  
  94.    'HISTORY "'||SourceName||'" compressed with method "'||Compressor||'".'
  95.   END
  96.  
  97.  IF LEFT(Data,1)="d" THEN
  98.   DO
  99.    'EXEC xPack "'||SourceName||'" METHOD' Compressor 'ALL'
  100.    TOGGLEENTRY Index
  101.  
  102.    'HISTORY Files in directory "'||SourceName||'" compressed with method "'||Compressor||'".'
  103.   END
  104. END
  105. UPDATESOURCEDIR
  106.  
  107.  
  108. 'STATUS Operation finished !' 
  109.  
  110. PANEL ON
  111. UNLOCKFILER Key
  112.